package com.jd.learn.config;

import com.ibm.etcd.client.EtcdClient;
import com.jd.learn.configcenter.JdEtcdClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

/**
 * @author shenkaiwen5
 * @version 1.0
 * @date 2020/12/22
 */
@Configuration
@PropertySource(value = {"classpath:configcenter.properties"})
public class ConfigCenterConfig {

    @Value("${etcd.endpoints}")
    String endPoints;

    @Bean
    public JdEtcdClient build() {
        return new JdEtcdClient(EtcdClient.forEndpoints(endPoints).withPlainText().build());
    }
}
